import React from 'react'
import { useDispatch,useSelector } from 'react-redux'
import { getMovieListAction } from '../../store/Slice/movieSlice'

export default function Movie() {
const dispatch = useDispatch()
const getMovieListHandle = ()=>{
  dispatch(getMovieListAction())
}
const count = useSelector(state=>state.count.count)
const movieList = useSelector(state=>state.movie.movieList)
console.log(movieList,'movieList');
  return (
    <div>
      <h1>我是Movie组件</h1>
      <p>我收到的Count组件的值是 {count}</p>
      <button onClick={getMovieListHandle}>点击获取电影列表</button>

      {
        movieList.map(item=>{
          return <li key={item.tvId}>{item.name}</li>
        })
      }
    </div>
  )
}
